<div ng-app="UserDetailModule">
	<div class="formbody">
		<div class="formtitle" ng-controller="tabCtrl">
			<span ng-repeat="tab in tabs"  ng-class="tab.class" ng-bind="tab.title" ng-click="go(tab)"></span>
		</div>
		<div ui-view></div>
	</div>
	<script type="text/ng-template" id="index.html">
	<table class="user-info">
		<thead>
<!-- 			<tr>
				<th width="100px"></th>
				<th width="100px"></th>
				<th width="200px"></th>
			</tr> -->
		</thead>
		<tbody>
			<tr>
				<th>ID:</th>
				<td ng-bind="user.id"></td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<th>昵称</th>
				<td ng-bind="user.nickname"></td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<th>权限</th>
				<td ng-bind="user.isTest==1 ? '测试人员':'普通用户'"></td>
				<td>
					<button class="ibtn" ng-click="setTester()" ng-bind="user.isTest==1 ? '设为普通用户':'设为测试人员'"></button>
				</td>
				<td></td>
			</tr>
			<tr>
				<th>学校</th>
				<td>
					<select  class="select" ng-model="updateData.schoolID">
					        <option value="0">请选择</option>
					        <option ng-repeat="school in schoolList" value="{{school.id}}" >{{school.name}}</option>
					</select>
					
				</td>
				<td>
					<input name="submit" type="button" ng-click="update()" class="ibtn" value="修改学校"/>
				</td>
				<td></td>
			</tr>
			<tr>
				<th>手机号码</th>
				<td ng-bind="user.phone"></td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<th>绑定微信</th>
				<td ng-bind="user.isBindWechat ? '已绑定':'未绑定'"></td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<th>可用余额</th>
				<td class="amount" ng-bind="user.balance/100"></td>
				<td>
					<button class="ibtn" ng-click="emptyBalance()">清空余额</button>
				</td>
				<td></td>
			</tr>
			<tr>
				<th>累计充值</th>
				<td class="amount" ng-bind="user.rechargeTotal/100"></td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<th>累计消费</th>
				<td class="amount" ng-bind="user.buyTotal/100"></td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<th>累计赠送</th>
				<td class="amount" ng-bind="user.presrent/100"></td>
				<td>
					<button class="ibtn" ng-click="presrentBalance()">赠送水费</button>
				</td>
				<td></td>
			</tr>
			<tr>
				<th>预付款余额</th>
				<td class="amount" ng-bind="user.prepayment/100"></td>
				<td>
					<button class="ibtn" ng-show="user.isBindOfflinePhone" ng-click="unbindOfflinePhone()">解绑离线授权手机</button>
				</td>
				<td></td>
			</tr>
			
		</tbody>
		
	</table>
	</script>
	<script type="text/ng-template" id="presrentBalance.html">
		<div class="tip" style="display: block;">
		    <div class="tiptop"><span>赠送水费</span>
		        <a ng-click="cancel()"></a>
		    </div>
		    <div class="tipinfo">
		        <ul class="forminfo">
		            <li>
		                <label>用户</label>
		                <label ng-bind="user.nickname"></label>
		            </li>
		            <li>
		                <label>赠送金额</label>
		                <input  type="number" min="0" class="scinput" ng-model="data.amount"><i>分</i>
		                <i class="amount" style="color: darkorange;" ng-bind="(data.amount/100)+'元'"></i></li>
		            <li>
		                <label>赠送理由</label>
		                <textarea name="reason" placeholder="不超过50个字" class="scinput" ng-model="data.reason"></textarea>
		            </li>
		            <li>
		                <label>&nbsp;</label>
		                <button type="button" class="btn" ng-click="confirm()">赠送</button>
		            </li>
		        </ul>
		    </div>
		</div>
	</script>





	<script type="text/ng-template" id="buy.html">
		<table class="tablelist">
		    <thead>
		        <tr>
		            <th width="200">状态</th>
		            <th>订单ID</th>
		            <th>取水秒数</th>
		            <th>金额</th>
		            <th>订单时间</th>
		        </tr>
		    </thead>
		    <tbody>
		        <tr ng-repeat="(rowIdx, row) in buyOrderRows">
		            <td>
		                <span ng-bind="row.isFinish==1?'结束':'取水中'" style="display: inline-block;"></span>
		                <button class="ibtn" ng-if="row.isFinish!=1" ng-click="closeOrder(row)" style="float:none;display: inline-block;">关闭订单</button>
		            </td>
		            <td ng-bind="row.id"></td>
		            <td ng-bind="row.takeSec"></td>
		            <td class="amount" ng-bind="row.amount/100"></td>
		            <td ng-bind="row.createTime"></td>
		        </tr>
		    </tbody>
		</table>
	</script>
	<script type="text/ng-template" id="recharge.html">
		<h1>充值订单</h1>
		<h2 ng-bind="title"></h2>
	</script>
</div>





<script type="text/javascript">
window.app = window.app || {};
window.app.config = window.app.config || {};
window.app.config.user = <?php echo json_encode($user->_user,JSON_UNESCAPED_UNICODE); ?> ;
window.app.config.schoolList = <?php echo json_encode($schoolList,JSON_UNESCAPED_UNICODE); ?>;  
</script>
<!-- <script src="//cdn.bootcss.com/angular.js/1.5.8/angular.js"></script> -->
<!-- <script src="//cdn.bootcss.com/angular-ui-router/1.0.0-rc.1/angular-ui-router.js"></script> -->
<script src="/js/lib/angular/1.5.8/angular.js"></script>
<script src="/js/lib/angular/ui-router/1.0.0-rc.1/angular-ui-router.js"></script>
<script type="text/javascript" src='/houtai/lib/common_ng.js'></script>
<script src="//cdn.bootcss.com/angular.js/1.5.8/angular-animate.js"></script>
<script src="//cdn.bootcss.com/angular-ui-bootstrap/2.0.0/ui-bootstrap-tpls.js"></script>
<script type="text/javascript" src="/houtai/js/user/detail.js"></script>